<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

//api.demo.com/user/2 ===> www.demo.com/index.php/api/user/index/2
use think\Route;

//
// Route::rule('api/user', 'index.php/api/user/index');
Route::get('api/users/:id$', 'api/user/index');
Route::post('api/users/login', 'api/user/login');
Route::put('api/users/password/:id$', 'api/user/up_pwd');
Route::put('api/users/email/:id$', 'api/user/up_email');

/********** 栏目 *********/
Route::get('api/cates', 'api/cate/index');
Route::post('api/cates', 'api/cate/add');
Route::put('api/cates', 'api/cate/update');
Route::delete('api/cates/:id', 'api/cate/delete');

/********** 文章 *********/
Route::get('api/articles$', 'api/article/index'); //完全匹配，可以使用$符号
Route::get('api/articles/:id', 'api/article/get');


Route::post('api/articles', 'api/article/add');
Route::put('api/articles', 'api/article/update');
Route::delete('api/articles/:id', 'api/article/delete');